package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Author wpj
 * @Date 2020/10/6
 */
@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_OPEN_BOX, desc = "花石纲打开宝箱")
public class CrossOpenBoxCmd extends CrossCommand {

    int boxId;
    int activityId;
    int num;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossOpenBoxReqMsg msg = HuaShiGangProto.CrossOpenBoxReqMsg.parseFrom(packet.getBytes());
        boxId = msg.getBoxId();
        activityId = msg.getActivityId();
        num = msg.getNum();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.openBox(activityId, serverId, packet.getPlayerId(), boxId, num);
    }

    @Override
    public void sendData() {

    }

}
